package demo;

import com.jfinal.core.Controller;
import com.jfinal.upload.UploadFile;

/**
 * 默认就是hello路径
 * @author tuyou
 */
public class HelloController extends Controller {
	
	/**
	 * 默认执行这个方法，相当于struts的execute方法
	 */
	public void index() {
		
		renderText("Hello JFinal World.");
		UploadFile file = getFile("file");
		System.out.println(file.getContentType());
		System.out.println(file.getFileName());
		System.out.println(file.getOriginalFileName());
		System.out.println(file.getParameterName());
		System.out.println(file.getUploadPath());
	}
	
	/**
	 * 文件上传
	 */
	public void upload(){
		
		UploadFile file = getFile("file");
		
		//获取参数必须在获取文件之后，否则获取不到
		String name = getPara("name");
		
		renderJsp("/other.jsp");
	}
}